import request from "@/libs/request";

const basePath = '/appcloud-builder-api' ;
export const apiUrls = {
  create : basePath + '/api/orchestrate/create',
  deleteOrchestrate : basePath + '/api/orchestrate/delete/',
  getOrchestrateInfo : basePath + '/api/orchestrate/getOrchestrateInfo/',
  getOrchestrateTemplate : basePath + '/api/orchestrate/getOrchestrateTemplate/',
  list : basePath + '/api/orchestrate/list',
  update : basePath + '/api/orchestrate/update',
  
}




const deployBasePath = '/appcloud-deploy-api' ;
export const apiUrlsDeploy = {
	againOrchestrate : deployBasePath + '/api/services/againOrchestrate/',
	deleteOrchestrateInstHistory : deployBasePath + '/api/services/deleteOrchestrateInstHistory/',
	deleteOrchestrateItemInst : deployBasePath + '/api/services/deleteOrchestrateItemInst/',
	getInstHistory : deployBasePath + '/api/services/getInstHistory/',
	getInstHistoryTemplate : deployBasePath + '/api/services/getInstHistoryTemplate/',
	getOrchestrateHistoryStatus : deployBasePath + '/api/services/getOrchestrateHistoryStatus/',
  getOrchestrateInstHistory : deployBasePath + '/api/services/getOrchestrateInstHistory',
  getOrchestrateActiveIp : deployBasePath + '/api/services/getOrchestrateActiveIp',
  orchestrate : deployBasePath + '/api/services/orchestrate',
  updateOrchestrateInstItem : deployBasePath + '/api/services/updateOrchestrateInstItem',
}



//const dataBasePath = '/appcloud-data' ;
//export const apiUrlsData = {
//orchestrate : apiUrlsData + '/api/services/orchestrate',
//}

//创建服务编排模板
export async function create(params){
	return request( apiUrls.create, {
      method:'POST',
      body:params
  })
}

//删除服务编排 // {serviceTemplateId}
export async function deleteOrchestrate(params){ 
	return request( apiUrls.deleteOrchestrate + params.id, {
      method:'GET',
  })
}


//获取服务编排模板列表 name支持模糊查询
export async function getOrchestrateInfo(params){
	return request( apiUrls.getOrchestrateInfo, {
      method:'POST',
      body:params
  })
}


//根据服务编排编号查询服务编排信息 
// serviceTemplateId
export async function getOrchestrateTemplate(params){
	return request( apiUrls.getOrchestrateTemplate + params.id , {
      method:'GET',
  })
}

//分页查询服务编排模板列表
export async function list(params){
	return request( apiUrls.list, {
      method:'POST',
      body:params
  })
}


//更新服务编排
export async function update(params){
	return request( apiUrls.update, {
      method:'POST',
      body:params
  })
}


/* ---------  */

//重新部署
export async function againOrchestrate(params){
	return request( apiUrlsDeploy.againOrchestrate, {
      method:'POST',
      body:params
  })
}


//删除服务编排发布历史 // {serviceInstId}
export async function deleteOrchestrateInstHistory(params){
	return request( apiUrlsDeploy.deleteOrchestrateInstHistory + params.id, {
      method:'GET',
  })
}

//根据instId删除服务编排明细实例记录 // {instId}
export async function deleteOrchestrateItemInst(params){
	return request( apiUrlsDeploy.deleteOrchestrateItemInst + params.id, {
      method:'GET',
  })
}



//获取服务编排发布历史详情
export async function getInstHistory(params){
	return request( apiUrlsDeploy.getInstHistory + params.id, {
      method:'GET',
  })
}


//获取服务编排模板详情(编排发布历史)
export async function getInstHistoryTemplate(params){
	return request( apiUrlsDeploy.getInstHistoryTemplate, {
      method:'POST',
      body:params
  })
}


//批量获取编排历史状态
export async function getOrchestrateHistoryStatus(params){
	return request( apiUrlsDeploy.getOrchestrateHistoryStatus, {
      method:'POST',
      body:params
  })
}

//查询编排可用ip信息(无itemInstId获取编排发布,有itemInstId获取修改编排内容)
export async function getOrchestrateActiveIp(params){
	return request( apiUrlsDeploy.getOrchestrateActiveIp, {
      method:'POST',
      body:params
  })
}


//获取服务编排发布历史
export async function getOrchestrateInstHistory(params){
	return request( apiUrlsDeploy.getOrchestrateInstHistory, {
      method:'POST',
      body:params
  })
}


//服务编排
export async function orchestrate(params){
	return request( apiUrlsDeploy.orchestrate, {
      method:'POST',
      body:params
  })
}


//更新服务编排实例明细(编排发布历史
export async function updateOrchestrateInstItem(params){
	return request( apiUrlsDeploy.updateOrchestrateInstItem, {
      method:'POST',
      body:params
  })
}


